package model

import (
	messageID "broker/struct/common/message_id"
)

/**
 * @Description
 * @Author huan.wang
 * @Date 2021/4/25 10:37 下午
 **/

type PublishMessage struct {
	*BaseMessage
	//重发标志
	DUP byte

	Qos byte

	Retain byte

	PacketID uint16

	Topic []byte

	Payload []byte
}

func (pm PublishMessage) GetTopicString() string {
	return string(pm.Topic)
}
func (pm PublishMessage) GetPayloadString() string {
	return string(pm.Payload)
}

func NewPublishMessage() *PublishMessage {
	return &PublishMessage{
		NewMsgIDBaseMessage(messageID.Publish),
		0,
		0,
		0,
		0,
		nil,
		nil,
	}
}
